package com.allianz.webapps.secondController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.ibatis.annotations.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.allianz.webapps.common.CustomerContextHolder;
import com.allianz.webapps.https.interfaces.type001.pojo.User;
import com.allianz.webapps.service.AcceptingService;
import com.allianz.webapps.service.BeforeUnderwritingService;
import com.allianz.webapps.service.MyPolicyService;
import com.allianz.webapps.service.PstateService;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 
 * 
 * @author 刘建弋
 * pad_marketing/Pstate/getPtate.action 保全状态下拉列表
 * pad_marketing/Pstate/getPitem.action 保全项目下拉列表
 * 2017年3月8日
 */
@Controller
@RequestMapping(value = "Pstate")
public class PstateController {
	
	@Autowired
	private PstateService pstateService;

	@RequestMapping(value = "getPtate")
	@ResponseBody
	public List<Map<String, Object>> getPtate() throws Exception {
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
		
		try {
			return pstateService.getPstate();
		} catch (Exception e) {
			throw new Exception("请检查您的网络");
		}
		
	}
	@RequestMapping(value = "getPitem")
	@ResponseBody
	public List<Map<String, Object>> getPitem() throws Exception {
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
		
		try {
			return pstateService.getPitem();
		} catch (Exception e) {
			throw new Exception("请检查您的网络");
		}
		
	}
}